<?php
$ci = &get_instance();
$ci->load->model("Docente_Model");
?>

<form class="well form-horizontal span8" action="<?php echo base_url() . "admin.php/matinicial/ingresodatos" ?>" method="post" >
    <legend>PROCESAR DATOS DE LA MATRICULACION</legend>

    <div class="tabbable">
        <ul class="nav nav-tabs">
            <li class="active"><a href="#1" data-toggle="tab">Datos Generales</a></li>
            <li><a href="#2" data-toggle="tab">Datos Estudiante</a></li>
            <li><a href="#3" data-toggle="tab">Datos Matriculaci&oacute;n</a></li>
        </ul>
        <div class="tab-content">
            <?php foreach ($estudiante as $i => $est) { ?>
                <div class="tab-pane active" id="1">
                    <div class="control-group">
                        <label class="control-label" for="input01">N&uacute;mero de Identificaci&oacute;</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="cedula_pers" value= "<?php echo $est['cedula_pers']; ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="select01">Tipo de Documento</label>
                        <div class="controls">

                            <select id="select01"  name="tipo_doc_pers">

                                <option value= "0" <?php echo ($est['tipo_doc_pers'] == 0 ? " selected" : " "); ?>>CEDULA</option>
                                <option value= "1" <?php echo ($est['tipo_doc_pers'] == 1 ? " selected" : " "); ?>>PASAPORTE</option>
                                <option value= "2" <?php echo ($est['tipo_doc_pers'] == 2 ? " selected" : " "); ?>>CARNE DE REFUGIADO</option>
                            </select>

                        </div>
                    </div>


                    <div class="control-group">
                        <label class="control-label" for="input02">Nombre Completos</label>
                        <div class="controls">
                            <input type="text" class="input-medium span4"  name="nombre_pers" value= "<?php echo $est['nombre_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input03">Apellidos </label>
                        <div class="controls">
                            <input type="text" class="input-medium span4"  name="apellido_pers" value= "<?php echo $est['apellido_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input04">Nacionalidad </label>
                        <div class="controls">
                            <input type="text" class="input-medium span3"  name="nacionalidad_pers" value= "<?php echo $est['nacionalidad_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input15">Provincia </label>
                        <div class="controls">
                            <input type="text" class="input-medium span3"  name="provincia_pers" value= "<?php echo $est['provincia_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input05">Ciudad </label>
                        <div class="controls">
                            <input type="text" class="input-medium span3"  name="ciudad_pers" value= "<?php echo $est['ciudad_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input06">Direccion del Domicilio</label>
                        <div class="controls">
                            <input type="text" class="input-medium span4"  name="direccion_pers" value= "<?php echo $est['direccion_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input07">Referencia del Domicilio</label>
                        <div class="controls">
                            <input type="text" class="input-medium span4"  name="refer_domic_pers" value= "<?php echo $est['refer_domic_pers']; ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input08">Tipo de Discapacidad</label>
                        <div class="controls">
                            <input type="text" class="input-medium span4"  name="tipo_discap_pers" value= "<?php echo $est['tipo_discap_pers']; ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input09">Carn&eacute; del CONADIS</label>
                        <div class="controls">
                            <input type="text" class="input-medium span3"  name="conadis_pers" value= "<?php echo $est['conadis_pers']; ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input010">Porcentaje de Discapacidad</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="porc_disc_pers" value= "<?php echo $est['porc_disc_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="select01">Sexo</label>
                        <div class="controls">

                            <select id="select01"  name="sexo_pers">
                                <option <?php echo ($est['sexo_pers'] == "HOMBRE" ? " selected" : " "); ?>>HOMBRE</option>
                                <option <?php echo ($est['sexo_pers'] == "MUJER" ? " selected" : " "); ?>>MUJER</option>
                            </select>

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="select02">Estado Civil</label>
                        <div class="controls">

                            <select id="select02"  name="estado_civil_pers">
                                <option <?php echo ($est['estado_civil_pers'] == "SOLTERO(A)" ? " selected" : " "); ?>>SOLTERO(A)</option>
                                <option <?php echo ($est['estado_civil_pers'] == "CASADO(A)" ? " selected" : " "); ?>>CASADO(A)</option>
                                <option <?php echo ($est['estado_civil_pers'] == "UNION LIBRE" ? " selected" : " "); ?>>UNION LIBRE</option>
                                <option <?php echo ($est['estado_civil_pers'] == "DIVORCIADO(A)" ? " selected" : " "); ?>>DIVORCIADO(A)</option>
                                <option <?php echo ($est['estado_civil_pers'] == "VIUDO(A)" ? " selected" : " "); ?>>VIUDO(A)</option>
                                <option <?php echo ($est['estado_civil_pers'] == "ECLECIASTICO(A)" ? " selected" : " "); ?>>ECLECIASTICO(A)</option>


                            </select>

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="select12">Autodefinici&oacute;</label>
                        <div class="controls">

                            <select id="select02"  name="autodefin_pers">
                                <option <?php echo ($est['autodefin_pers'] == "NEGRO" ? " selected" : " "); ?>>NEGRO</option>
                                <option <?php echo ($est['autodefin_pers'] == "MULATO" ? " selected" : " "); ?>>MULATO</option>
                                <option <?php echo ($est['autodefin_pers'] == "AFROECUATORIANO" ? " selected" : " "); ?>>AFROECUATORIANO</option>
                                <option <?php echo ($est['autodefin_pers'] == "INDIGENA" ? " selected" : " "); ?>>INDIGENA</option>
                                <option <?php echo ($est['autodefin_pers'] == "MESTIZO" ? " selected" : " "); ?>>MESTIZO</option>
                                <option <?php echo ($est['autodefin_pers'] == "MONTUBIO" ? " selected" : " "); ?>>MONTUBIO</option>
                                <option <?php echo ($est['autodefin_pers'] == "BLANCO" ? " selected" : " "); ?>>BLANCO</option>
                                <option <?php echo ($est['autodefin_pers'] == "OTRO" ? " selected" : " "); ?>>OTRO</option>


                            </select>

                        </div>
                    </div>


                    <div class="control-group">
                        <label class="control-label" for="select03">Fecha de Nacimiento</label>
                        <div class="controls">
                            <input type="text" class="input-medium "  id="datepicker" name="fecha_nac_pers" value="<?php echo date("m/d/Y", strtotime($est['fecha_nac_pers'])); ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input08">N&uacute;mero de tel&eacute;fono</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="fono_pers" value= "<?php echo $est['fono_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input09">N&uacute;mero de celular</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="celular_pers" value= "<?php echo $est['celular_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input10">Correo Electr&oacute;nico Institucional</label>
                        <div class="controls">
                            <input type="text" class="input-medium span3"  name="email_inst_pers" value= "<?php echo $est['email_inst_pers']; ?>">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input11">Fotograf&iacute;a</label>
                        <div class="controls">
                            <img src="<?php echo $est['foto_pers']; ?>" width="88" height="99" alt="itss1"/>
                        </div>
                    </div>



                </div>
                <div class="tab-pane" id="2">

                    <div class="control-group">
                        <label class="control-label" for="input11">Plantel de Procedencia </label>
                        <div class="controls">
                            <input type="text" class="input-medium span4"  name="planted_procede_est" value= "<?php echo $est['planted_procede_est']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input12">Especialidad de Graduaci&oacute;n</label>
                        <div class="controls">
                            <input type="text" class="input-medium span4"  name="especialidad_est" value= "<?php echo $est['especialidad_est']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input14">Nombres del Padre</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="nombre_padre_est" value= "<?php echo $est['nombre_padre_est']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input16">Profesi&oacute;n del Padre</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="profesion_padre_est" value= "<?php echo $est['profesion_padre_est']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input17">Nombres de la Madre</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="nombre_madre_est" value= "<?php echo $est['nombre_madre_est']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input19">Profesi&oacute;n de la Madre</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="profesion_madre_est" value= "<?php echo $est['profesion_madre_est']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input20">Nombre del Conjugue</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="conjuge_est" value= "<?php echo $est['conjuge_est']; ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input21">Cargas Familiares</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="carga_fam_est" value= "<?php echo $est['carga_fam_est']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input20">Tipo de Sangre</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="tipo_sangre_est" value= "<?php echo $est['tipo_sangre_est']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="select13">Sector</label>
                        <div class="controls">

                            <select id="select04"  name="sector_est">
                                <option <?php echo ($est['sector_est'] == "URBANO" ? " selected" : " "); ?>>URBANO</option>
                                <option <?php echo ($est['sector_est'] == "RURAL" ? " selected" : " "); ?>>RURAL</option>
                            </select>

                        </div>


                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input21">Correo Electr&oacute;nico Personal</label>
                        <div class="controls">
                            <input type="text" class="input-medium span3"  name="email_pers_est" value= "<?php echo $est['email_pers_est']; ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input22">Facebook</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="face_est" value= "<?php echo $est['face_est']; ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input24">Twitter</label>
                        <div class="controls">
                            <input type="text" class="input-medium span3"  name="twit_est" value= "<?php echo $est['twit_est']; ?>">

                        </div>
                    </div>


                    <div class="control-group">
                        <label class="control-label" for="select03">Estudia</label>
                        <input type="checkbox" name="estud_traba_est" value="0" <?php echo ($est["estud_traba_est"] == 0 ? "checked='checked'" : ""); ?> />

                    </div>

                    <div class="control-group">
                        <label class="control-label" for="select04">Activo</label>
                        <input type="checkbox" name="activo_est" value="1" <?php echo ($est["activo_est"] == 1 ? "checked='checked'" : ""); ?> />

                    </div>
                </div>


            <?php } ?>
            <div class="tab-pane" id="3">

                <div class="control-group">
                    <label class="control-label" for="select01">PERIODO</label>
                    <div class="controls ">
                        <select name="ide_lec" class="span3">
                            <option ><?php echo $ide_lec_nom; ?></option>
                        </select>

                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label" for="select03">CARRERA</label>
                    <div class="controls ">
                        <select name="ide_car" class="span3" >
                            <option ><?php echo $ide_car_nom; ?></option>
                        </select>

                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label" for="select03">Pensums</label>
                    <div class="controls ">
                        <select id="select02" name="ide_pen" class="span3">
                            <option ><?php echo $ide_pen_nom; ?></option>
                        </select>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="select04">Ciclo</label>
                    <div class="controls ">
                        <select id="select02" name="" class="span3">

                            <option ><?php echo $ide_ciclo_nom; ?></option>
                        </select>
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label" for="select02">JORNADA DE TRABAJO</label>
                    <div class="controls ">
                        <select name="seccion" class="span3">
                            <option ><?php echo $seccion_nom; ?></option>
                        </select>


                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="select02">PARALELO</label>
                    <div class="controls ">
                        <select name="paralelo" class="span1">
                            <option ><?php echo $paralelo_nom; ?></option>
                        </select>


                    </div>
                </div>


                <div class="control-group">
                    <label class="control-label" for="select08">Fecha de la Matr&iacute;cula</label>
                    <div class="controls">

                        <input type="text" class="input-medium "  id="datepicker1" name="fecha_matr" value="<?php echo date("m/d/Y"); ?>" >

                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label" for="input02">Nro. de Cupo</label>
                    <div class="controls">
                        <input type="text" class="input-medium span1"  name="cupo" value="<?php echo $nro_cup; ?>" disabled>

                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="input02">Nro. de Matr&iacute;cula</label>
                    <div class="controls">
                        <input type="text" class="input-medium span1"  name="nro" value="<?php echo $nro_mat; ?>" disabled>

                    </div>
                </div>


                <div class="control-group">
                    <label class="control-label" for="input11">ESTADO </label>
                    <div class="controls">
                        <select id="estado_cur" name="estado_cur" disabled>
                            <option value="1">EN PROCESO</option>
                            <option value="2">ACEPTADA</option>
                            <option value="3">NEGADA</option>
                            <option value="4">DEVOLUCION</option>


                        </select>


                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="input11">TIPO DE MATRICULA &nbsp;</label>
                    <div class="controls">
                        <select id="tipo_matr" name="tipo_matr" >
                            <option value="1">ORDINARIA</option>
                            <option value="2">EXTRAORDINARIA</option>
                            <option value="3">ESPECIAL</option>
                        </select>

                    </div>
                </div>

                <div id="tablabeca" >
                    <table name="becas" border="0">
                        <tbody>
                            <tr>
                                <td>
                                    <label class="control-label" for="input11">TIPO DE RESOLUCION &nbsp;</label>
                                    <select id="tipo_matr" name="tipo_resol_mat" >
                                        <option value="0">NINGUNA</option>
                                        <option value="1">ACADEMICA</option>
                                        <option value="2">DISCAPACIDAD</option>
                                        <option value="3">CONSEJO DIRECTIVO</option>
                                        <option value="4">SNNA-SENESCYT</option>
                                        <option value="5">ENF. CATASTROFICA</option>
                                    </select>
                                </td>
                                <td>
                                    <label class="control-label" for="input21">TIPO BECA &nbsp;</label>
                                    <select id="forma_pago" name="forma_pago" >
                                        <option value="0">NINGUNA</option>
                                        <option value="3"  >BECA DEL100%</option>
                                        <option value="4"  >BECA DEL 75%</option>
                                        <option value="5"  >BECA DEL 50%</option>
                                        <option value="6"  >BECA DEL 25%</option>

                                    </select>
                                </td>
                            </tr>                            
                        </tbody>
                    </table>        
                </div> 
                <br>

                <div id="tablamatriculai" >
                    <table class="table table-bordered table-striped table-condensed">
                        <thead>
                            <tr>
                                <th>ASIGNA</th>
                                <th>COD</th>
                                <th>MATERIA</th>
                                <th>CRED</th>
                                <th>ESTADO</th>
                                <th>DOCENTE</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $nro_filas = 0;
                            if (!empty($materias)) {
                                $nro_filas = count($materias);
                                foreach ($materias as $i => $mat) {
                                    ?>
                                    <tr>
                                        <td ><div centrar align="center"><i class="icon-ok"></i>
                                                <input type="hidden" <?php echo "name='ide_mat" . $i . "' value='" . $mat['ide_mat'] . "'"; ?>>
                                            </div></td>
                                        <td><?php echo $mat['codigo_mat'] ?></td>
                                        <td><?php echo $mat['nombre_mat'] ?></td>
                                        <td><?php echo $mat['creditos_mat'] ?></td>
                                        <td><?php echo ($mat['estado'] == 0 ? 'ACTIVO' : 'PENDIENTE'); ?></td>
                                        <td >
                                            <select id="select01"  <?php echo "name='ide_doc" . $i . "'"; ?> class="span3">
                                                <?php
                                                $docentes = $this->Docente_Model->getDatosDocente($mat['ide_pers']);

                                                foreach ($docentes as $k => $doc) {
                                                    echo ("<option value='" . $doc["ide_doc"] . "'>");
                                                    echo ($doc["apellido_pers"] . " " . $doc["nombre_pers"] . "</option>");
                                                }
                                                ?>

                                            </select>


                                        </td>   
                                    </tr>
                                    <?php
                                }
                            }
                            ?>
                        </tbody>
                    </table>        
                </div>     
                <div class="control-group">
                    <label class="control-label" for="textarea">OBSERVACION</label>
                    <div class="controls">
                        <textarea class="input-xxlarge" id="observa_cur" name="observa_cur" rows="2" value=""></textarea>
                    </div>
                </div>




            </div>  <!--fin tabulador 3 -->
        </div>
    </div>

    <?php if (isset($msj_error)) { ?>
        <div class='MensajeError'>
            <?php echo ($msj_error); ?>
        </div>
    <?php } ?>

    <fieldset>
        <div class="control-group"> 
            <div class="controls">
                <input type="hidden" name="nro_filas" value="<?php echo $nro_filas; ?>">
                <input type="hidden" name="ide_lec" value="<?php echo $ide_lec; ?>">
                <input type="hidden" name="ide_car" value="<?php echo $ide_car; ?>">
                <input type="hidden" name="ide_pen" value="<?php echo $ide_pen; ?>">
                <input type="hidden" name="ide_ciclo" value="<?php echo $ide_ciclo; ?>">
                <input type="hidden" name="seccion" value="<?php echo $seccion; ?>">
                <input type="hidden" name="paralelo" value="<?php echo $paralelo; ?>">
                <input type="hidden" name="ide_est" value="<?php echo $est["ide_est"]; ?>">
                <input type="hidden" name="cambio" value="<?php echo $cambio; ?>">

                <input type="hidden" name="ide_matr" value="<?php echo $ide_matr; ?>">
                <input type="hidden" name="cupo_cur" value="<?php echo $nro_cup; ?>">
                <input type="hidden" name="nro_matr" value="<?php echo $nro_mat; ?>">

            </div>
        </div >
    </fieldset>



    <div class="controls">

        <button type="submit" class="btn">Grabar Matricula</button>

        <a href="<?php echo base_url() . "admin.php/matinicial/inicio" ?>">
            <img src="<?php echo base_url(); ?>commons/images/boton_volver.gif"></a>

    </div> 



</form>


